home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1993 July / InfoMagic USENET CD-ROM July 1993.ISO / sources / misc / volume8 / up < prev    next >
Encoding:
Text File  |  1989-10-28  |  33.9 KB  |  1,246 lines

  1. Newsgroups: comp.sources.misc
  2. subject: v08i095: Up: utilities to print conforming PostScript n-up
  3. From: allbery@uunet.UU.NET (Brandon S. Allbery - comp.sources.misc)
  4. Reply-To: jgreely@cis.ohio-state.edu (J Greely)
  5.  
  6. Posting-number: Volume 8, Issue 95
  7. Submitted-by: jgreely@cis.ohio-state.edu (J Greely)
  8. Archive-name: up
  9.  
  10. This package allows you to print conforming PS files n-up, with the
  11. scaling, rotation, and page positioning code kept in a readable
  12. configuration file.  It includes a utility to create numbered test
  13. pages, as well as one that rearranges the pages in a PostScript file
  14. into signature order, for producing two-up, double-sided booklets.
  15. The scripts are written in Perl, and require that version 3.0 be
  16. available.  If you don't have Perl, how-to instructions are provided
  17. for converting to another language.  It is known to work on the output
  18. of enscript, pscat, psdit (all from the Adobe TranScript package), the
  19. Adobe documentation supplied with NeXT release 1.0, and absolutely
  20. *no* dvi-to-PS converter (dvips 4.2 seems the most promising, and I'm
  21. working on appropriate hacks).
  22.  
  23. #! /bin/sh
  24. # This is a shell archive.  Remove anything before this line, then unpack
  25. # it by saving it into a file and typing "sh file".  To overwrite existing
  26. # files, type "sh file -c".  You can also feed this as standard input via
  27. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  28. # will see the following message at the end:
  29. #        "End of shell archive."
  30. # Contents:  README HowTo Makefile up makeup parr up.rc up.1 makeup.1
  31. #   parr.1 uprc.5
  32. # Wrapped by jgreely@cis.ohio-state.edu on Tue Oct 24 15:16:22 1989
  33. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  34. if test -f 'README' -a "${1}" != "-c" ; then 
  35.   echo shar: Will not clobber existing file \"'README'\"
  36. else
  37. echo shar: Extracting \"'README'\" \(3286 characters\)
  38. sed "s/^X//" >'README' <<'END_OF_FILE'
  39. X            Up, a PostScript print utility
  40. X        hacked together with a two-by-four by J Greely
  41. X             (jgreely@cis.ohio-state.edu)
  42. X
  43. X
  44. XThis package allows you to print conforming PS files n-up, with the
  45. Xscaling, rotation, and page positioning code kept in a readable
  46. Xconfiguration file.  It has successfully been used on the output of
  47. Xptroff, enscript, psdit (all from Adobe's TranScript package), and the
  48. XAdobe documentation supplied with NeXT release 1.0, and should work on
  49. Xany file that obeys the rules the way I assume (note: it does not
  50. Xcurrently work with any known dvi-to-PS converter; I'm making some
  51. Xchanges to make it work with dvips 4.2 (available for anonymous ftp at
  52. Xlabrea.stanford.edu), but they're not done yet).  The major feature is
  53. Xthe ability to create your own layouts, with arbitrary scaling,
  54. Xtranslations, and rotations.  The output can be fed back through, for
  55. Xfurther reduction/destruction.
  56. X
  57. X  Warning: if you don't have Larry Wall's Perl language installed,
  58. Xthis utility will be useless to you.  It's not hard (ok, trivial) to
  59. Xconvert it to Nawk or C, and I'll probably get around to it soon, but
  60. Xfor now you need Perl (version 3.0).  Debates on the merits of Perl as
  61. Xa programming language are discouraged by the author.  If Perl is not
  62. Xlocated in /usr/bin, you'll need to change the first line of each
  63. Xexecutable.
  64. X
  65. X  To use, unpack the shar file somewhere, edit the top of Makefile to
  66. Xindicate where things should go, and type "make install". It will
  67. Xinstall several symlinks to the script, as well as a general
  68. Xconfiguration file, which can be overridden by the user.
  69. X
  70. X  Currently, it installs links to print 2, 4, 6, and 16 pages per
  71. Xsheet, and the supplied configuration file has sample layouts for
  72. Xdoing (among others) 8-up, 4-up in greeting-card positions, 10-up in a
  73. Xshrinking spiral, and more.  4up and 16up simply scale the page by .5
  74. Xand .25, respectively (white lie; read my excuse in the config file).
  75. X2up and 6up are rotated, and the page positioning is given below:
  76. X
  77. X            +-----+-----+   +---+---+---+
  78. X                    |     |     |   | 1 | 2 | 3 |
  79. X                    |  1  |  2  |   +---+---+---+
  80. X                    |     |     |   | 4 | 5 | 6 |
  81. X                    +-----+-----+   +---+---+---+
  82. X
  83. X
  84. X  Note to NeXT users: both Preview and Yap can be used to preview
  85. Xoutput under release 1.0.  Previous versions wouldn't work quite
  86. Xright.
  87. X
  88. X  Note to people in general: after I finished writing this, someone
  89. Xtold me of at least one other n-up utility.  The one I've seen works
  90. Xby what might be called elegant PostScript hacking, but I think mine
  91. Xsolves a different problem.
  92. X
  93. X  Bugs, suggestions, offers of money and sacrifices, and anything
  94. Xinteresting done with this package will be cheerfully accepted.
  95. XDespite rumors to the contrary, I am *not* a black hole for e-mail.
  96. X
  97. X
  98. XAdditional utilities supplied:
  99. X
  100. Xparr    - Page ARRanger.  For arbitrary reordering of pages in a
  101. X      conforming PS file.  Switches are provided to automatically
  102. X      do signature-order printing for two-up, left-to-right
  103. X      layouts ("up -n pup").  Pages can be printed more than once
  104. X      or not at all, and blank pages may be inserted anywhere.
  105. X
  106. Xmakeup    - generates numbered test pages, for debugging new layouts
  107. X
  108. X--
  109. XJ Greely (jgreely@cis.ohio-state.edu; osu-cis!jgreely), 89/10/23
  110. END_OF_FILE
  111. if test 3286 -ne `wc -c <'README'`; then
  112.     echo shar: \"'README'\" unpacked with wrong size!
  113. fi
  114. # end of 'README'
  115. fi
  116. if test -f 'HowTo' -a "${1}" != "-c" ; then 
  117.   echo shar: Will not clobber existing file \"'HowTo'\"
  118. else
  119. echo shar: Extracting \"'HowTo'\" \(5776 characters\)
  120. sed "s/^X//" >'HowTo' <<'END_OF_FILE'
  121. XQuick summary of what this package does, and how to duplicate its
  122. Xeffects if you don't like my code.
  123. X
  124. XA conforming PostScript file, for my purposes, is anything that meets
  125. Xall of the following requirements:
  126. X
  127. X1) first line must begin with the string '%!PS-Adobe'.
  128. X2) Each page must begin with a '%%Page:' line, and the graphics state
  129. X   must be the default at that point (no translation, scaling, or
  130. X   rotation of the coordinate space can carry over between pages).
  131. X   The pages must be numbered starting at 1, which is a bit pedantic
  132. X   of me.  It's part of the spec, but it is by no means necessary for
  133. X   the code to work.  It's a one-line check, and I'm thinking of just
  134. X   scrapping it.
  135. X3) There must be a '%%Trailer' line.
  136. X
  137. X
  138. XAs for what I *do* with all this, it's simple:
  139. X
  140. X1) When I see the '%!PS-Adobe' line, I insert the following lines
  141. X   (ignoring the old '%!PS' line):
  142. X    %!PS-Adobe-2.0
  143. X    %%Pages: (atend)
  144. X   Page counts in the header are first-comes, first-served, so putting
  145. X   mine at the very top will override anything that was in the
  146. X   original file (and since the whole idea is to change the number of
  147. X   pages, this is 'a good thing').  Since I do everything in one pass,
  148. X   I have no idea how many pages there will be, so I defer it until
  149. X   the end.
  150. X2) When I reach the end of the header comments (signified by the first
  151. X   non-%% line or an explicit %%EndComments line), I insert the
  152. X   user-defined prolog definitions into their own dictionary.  To
  153. X   simplify nesting, I use the current PID as part of the dictionary
  154. X   name.  I save the old value of showpage here, and redefine it to
  155. X   print nothing.  It looks like this (modulo interpretation of
  156. X   variables marked by <>):
  157. X    %%BeginProcSet: up_prolog 1 <pid>
  158. X    /UpDict<pid> $plines 3 add dict def
  159. X    UpDict<pid> begin
  160. X    <user prolog>
  161. X    /UpShowpage {showpage} bind def
  162. X    /UpState {} def
  163. X    end
  164. X    /showpage {} def
  165. X    %%EndProcSet: up_prolog 1 <pid>
  166. X3) For every '%%Page:' line, I first delete it, and then, if it is the
  167. X   first page on a sheet, I save the current VM state, and insert the
  168. X   user-specified scaling, rotation, and translation commands.  It
  169. X   looks like this (modulo the interpolation of the variables marked
  170. X   by <>):
  171. X    %%Page: ? <sheet number>
  172. X    UpDict<pid> begin
  173. X    save /UpState exch def
  174. X    <even/odd>
  175. X    <scale, translate, rotate>
  176. X    <page positioning>
  177. X    end
  178. X   For pages that don't start a sheet, I just insert:
  179. X    UpDict<pid> begin
  180. X    <page positioning>
  181. X    end
  182. X5) At the end of every sheet, I restore the VM state, and perform a
  183. X   real showpage, like so:
  184. X    UpDict<pid> begin UpState restore UpShowpage end
  185. X6) When I see the '%%Trailer' line, I replace it with:
  186. X    UpDict<pid> begin UpState restore UpShowpage end
  187. X    %%Trailer
  188. X   You might suspect that this causes an error, or the printing of a
  189. X   blank page, and if everything I said above were true, you'd be
  190. X   right.  The catch is that #5 is a lie.  I detect the end of a sheet
  191. X   by finding myself at the beginning of a new one, so the last sheet
  192. X   never gets printed, unless it's done just before the trailer.
  193. X7) The last bit is simple.  After the very last line of the input is
  194. X   printed, the actual sheet count is added.  This has to be this way,
  195. X   since the *last* in a series of trailer comments is the one heeded.
  196. X   It looks like this:
  197. X    %%Pages: <sheet count>
  198. X
  199. X
  200. XIf this isn't entirely clear, here's a before/after.
  201. X
  202. X----------
  203. XConforming PS file, which prints 4 numbered pages (output of "makeup 4"):
  204. X
  205. X%!PS-Adobe-1.0
  206. X%%Creator: makeup
  207. X%%Title: Page Layout Test
  208. X%%CreationDate: Tue Oct 24 02:33:36 EDT 1989
  209. X%%Pages: (atend)
  210. X%%DocumentFonts: Times-Roman
  211. X%%BoundingBox: 0 0 612 792
  212. X%%EndComments
  213. X/inch {72 mul} def
  214. X/Nfont /Times-Roman findfont 5 inch scalefont def
  215. X/drawpage {
  216. X    2 setlinecap 3 setlinewidth 0 setgray
  217. X    Nfont setfont
  218. X    dup stringwidth
  219. X    11 inch exch sub 2 div
  220. X    exch 8.5 inch exch sub 2 div
  221. X    exch moveto show
  222. X    0.25 inch dup moveto
  223. X    8 inch 0 rlineto
  224. X    0 10.5 inch rlineto
  225. X    -8 inch 0 rlineto
  226. X    0 -10.5 inch rlineto
  227. X    closepath stroke
  228. X    showpage
  229. X} def
  230. X%%EndProlog
  231. X%%Page: ? 1
  232. X(1) drawpage
  233. X%%Page: ? 2
  234. X(2) drawpage
  235. X%%Page: ? 3
  236. X(3) drawpage
  237. X%%Page: ? 4
  238. X(4) drawpage
  239. X%%Trailer
  240. X%%Pages: 4
  241. X
  242. X----------
  243. XPrevious file, filtered to print two pages per sheet ("up -n 2up"):
  244. X
  245. X%!PS-Adobe-2.0
  246. X%%Pages: (atend)
  247. X%%Creator: makeup
  248. X%%Title: Page Layout Test
  249. X%%CreationDate: Tue Oct 24 02:33:36 EDT 1989
  250. X%%Pages: (atend)
  251. X%%DocumentFonts: Times-Roman
  252. X%%BoundingBox: 0 0 612 792
  253. X%%EndComments
  254. X%%BeginProcSet: up_prolog 1 7482
  255. X/UpDict7482 23 3 add dict def
  256. XUpDict7482 begin
  257. X/inch {72 mul} def
  258. X/moveU {0 11 inch translate} def
  259. X/moveR {8.5 inch 0 translate} def
  260. X/moveD {0 -11 inch translate} def
  261. X/moveL {-8.5 inch 0 translate} def
  262. X/rotR {-90 rotate} def
  263. X/rotL {90 rotate} def
  264. X/doSpiral {moveU moveR rotR 0.67 dup scale} def
  265. X/moveHU { 0 5.5 inch translate} def
  266. X/doRevSpiral {moveHU rotL 0.67 dup scale} def
  267. X/UpShowpage {showpage} bind def
  268. X/UpState {} def
  269. Xend
  270. X/showpage {} def
  271. X%%EndProcSet: up_prolog 1 7482
  272. X/inch {72 mul} def
  273. X/Nfont /Times-Roman findfont 5 inch scalefont def
  274. X/drawpage {
  275. X    2 setlinecap 3 setlinewidth 0 setgray
  276. X    Nfont setfont
  277. X    dup stringwidth
  278. X    11 inch exch sub 2 div
  279. X    exch 8.5 inch exch sub 2 div
  280. X    exch moveto show
  281. X    0.25 inch dup moveto
  282. X    8 inch 0 rlineto
  283. X    0 10.5 inch rlineto
  284. X    -8 inch 0 rlineto
  285. X    0 -10.5 inch rlineto
  286. X    closepath stroke
  287. X    showpage
  288. X} def
  289. X%%EndProlog
  290. X%%Page: ? 1
  291. XUpDict7482 begin
  292. Xsave /UpState exch def
  293. X7.75 inch 0 translate rotL 11 17 div dup scale
  294. Xend
  295. X(1) drawpage
  296. XUpDict7482 begin
  297. XmoveR
  298. Xend
  299. X(2) drawpage
  300. XUpDict7482 begin UpState restore UpShowpage end
  301. X%%Page: ? 2
  302. XUpDict7482 begin
  303. Xsave /UpState exch def
  304. X7.75 inch 0 translate rotL 11 17 div dup scale
  305. Xend
  306. X(3) drawpage
  307. XUpDict7482 begin
  308. XmoveR
  309. Xend
  310. X(4) drawpage
  311. XUpDict7482 begin UpState restore UpShowpage end
  312. X%%Trailer
  313. X%%Pages: 2
  314. X
  315. X--
  316. XJ Greely (jgreely@cis.ohio-state.edu; osu-cis!jgreely)
  317. END_OF_FILE
  318. if test 5776 -ne `wc -c <'HowTo'`; then
  319.     echo shar: \"'HowTo'\" unpacked with wrong size!
  320. fi
  321. # end of 'HowTo'
  322. fi
  323. if test -f 'Makefile' -a "${1}" != "-c" ; then 
  324.   echo shar: Will not clobber existing file \"'Makefile'\"
  325. else
  326. echo shar: Extracting \"'Makefile'\" \(1059 characters\)
  327. sed "s/^X//" >'Makefile' <<'END_OF_FILE'
  328. X# Makefile to install 'up'
  329. X#
  330. XLIBDIR=/usr/local/lib
  331. XBINDIR=/usr/local/bin
  332. XMANDIR=/usr/man
  333. XSYMLINK=ln -s
  334. X
  335. XPROG=up
  336. XUTIL=makeup parr
  337. XLIB=up.rc
  338. XLINKS=2up 4up 6up 16up
  339. XMAN1=up.1 makeup.1 parr.1
  340. XMAN5=uprc.5
  341. X
  342. XFILES=README HowTo Makefile $(PROG) $(UTIL) $(LIB) $(MAN1) $(MAN5)
  343. X
  344. Xdefault:
  345. X    @echo Edit Makefile, changing the values of LIBDIR, BINDIR,
  346. X    @echo MANDIR, and SYMLINK, then type \"make install\"
  347. X
  348. Xinstall: $(PROG) $(UTIL) $(LIB) $(MAN1) $(MAN5)
  349. X    cp $(PROG) $(UTIL) $(BINDIR)
  350. X    cp $(LIB) $(LIBDIR)
  351. X    for i in $(LINKS); do $(SYMLINK) $(BINDIR)/$(PROG) $(BINDIR)/$$i; done
  352. X    @-mkdir $(MANDIR)
  353. X    @-mkdir $(MANDIR)/man1
  354. X    @-mkdir $(MANDIR)/man5
  355. X    cp $(MAN1) $(MANDIR)/man1
  356. X    cp $(MAN5) $(MANDIR)/man5
  357. X
  358. Xclean:
  359. X    rm -f core up.shar* *~
  360. X
  361. Xuninstall:
  362. X    -for i in $(PROG) $(UTIL) $(LINKS); do rm $(BINDIR)/$$i; done
  363. X    -rm $(LIBDIR)/$(LIB)
  364. X    -for i in $(MAN1); do rm $(MANDIR)/man1/$$i; done
  365. X    -for i in $(MAN5); do rm $(MANDIR)/man5/$$i; done
  366. X
  367. Xup.shar: $(FILES)
  368. X    shar $(FILES) >up.shar
  369. X    perl -i.old -pe 's/jgreely@[-.\w]+[-\w]/jgreely@cis.ohio-state.edu/g;'\
  370. X    up.shar
  371. X    rm up.shar.old
  372. END_OF_FILE
  373. if test 1059 -ne `wc -c <'Makefile'`; then
  374.     echo shar: \"'Makefile'\" unpacked with wrong size!
  375. fi
  376. # end of 'Makefile'
  377. fi
  378. if test -f 'up' -a "${1}" != "-c" ; then 
  379.   echo shar: Will not clobber existing file \"'up'\"
  380. else
  381. echo shar: Extracting \"'up'\" \(4810 characters\)
  382. sed "s/^X//" >'up' <<'END_OF_FILE'
  383. X#!/usr/local/bin/perl
  384. X# up:
  385. X# PostScript n-up print utility.  This script takes conforming PS
  386. X# files, and prints them n-up, where n is controlled by a symbolic
  387. X# name (taken from argv[0] or the command line), and the page
  388. X# positioning and scaling are looked up in a configuration file.
  389. X#
  390. X# usage: up [-n name] [-f config] [file ...]
  391. X#
  392. X# jgreely@cis.ohio-state.edu, 89/10/23
  393. X#
  394. X
  395. X# set the name from $0 (argv[0]), after stripping a path
  396. X#
  397. X@foo = split(/\//,$0);
  398. X$name=pop(@foo);
  399. X
  400. X$HOME=$ENV{"HOME"};
  401. X
  402. X# set a default prolog in case the config file doesn't have one
  403. X# make sure that plines is 2 larger than the number of definitions in
  404. X# the prolog (used to get dictionary size).
  405. X#
  406. X$plines=10;
  407. X$prolog = <<EOF;
  408. X/inch {72 mul} def
  409. X/moveU {0 11 inch translate} def
  410. X/moveR {8.5 inch 0 translate} def
  411. X/moveD {0 -11 inch translate} def
  412. X/moveL {-8.5 inch 0 translate} def
  413. X/rotR {-90 rotate} def
  414. X/rotL {90 rotate} def
  415. XEOF
  416. X
  417. X# search for a configuration file.  The *last* one found is used
  418. X#
  419. X$config = "./up.rc";
  420. X@search_path = ("/usr/lib/up.rc","/usr/local/lib/up.rc","$HOME/.uprc",
  421. X                "./up.rc"); 
  422. Xforeach $file (@search_path) {
  423. X    $config = $file if (-f $file && -r $file);
  424. X}
  425. X
  426. X# check for options on command line.
  427. X#
  428. Xwhile ($_ = $ARGV[0],/^-/) {
  429. X    shift;
  430. X    last if /^-\-$/;
  431. X    /^-[Ff]/ && ($config = shift,next);
  432. X    /^-[Nn]/ && ($name = shift,next);
  433. X    die "usage: up [-f config] [-n name] [file ...]\n";
  434. X}
  435. X
  436. X# read relevant section of configuration file.    For complete format
  437. X# description, see the provided up.rc file or uprc(5).
  438. X#  Basically, read the config file until we find a line containing a
  439. X# name field equal to the current name.     Once we do, read all name-
  440. X# value pairs up until a line containing just a '.', placing them all
  441. X# into an associative array.
  442. X#
  443. Xopen(config) ||
  444. X  die "can't find file '$config', stopped";
  445. X$in_rec = 0;
  446. Xwhile(<config>) {
  447. X    chop;
  448. X    next if /^\s*#|^\s*$/;    # skip comment and blank lines
  449. X    if (/^prolog\s*=/) {
  450. X        do read_prolog();
  451. X        next;
  452. X    }
  453. X    next unless ($in_rec || /$name/);
  454. X    ($field,$value) = split(/\s*=\s*/);
  455. X    if (($field eq "name") && ($value eq $name)) {
  456. X        $in_rec++;
  457. X        next;
  458. X    }
  459. X    last if /^\.$/;
  460. X    $var{$field} = $value;
  461. X}
  462. Xclose(config);
  463. Xdie "no such record '$name' in file '$config', stopped" unless $in_rec;
  464. X$modulus = $var{"modulus"};
  465. Xdie "invalid modulus == $modulus, stopped" unless $modulus;
  466. X
  467. X$_ = <>;
  468. Xif (/^%!PS-Adobe/) {
  469. X    print <<EOF;
  470. X%!PS-Adobe-2.0
  471. X%%Pages: (atend)
  472. XEOF
  473. X}else{
  474. X    die "Not conforming PostScript (no %!PS-Adobe), stopped";
  475. X}
  476. X
  477. X# read comment section (up to first non-%% line, or %%EndComments)
  478. X#
  479. Xwhile (<>) {
  480. X    if (!/^%%/) {
  481. X        do print_prologue();
  482. X        print;
  483. X        last;
  484. X    }
  485. X    if (/^%%EndComments/) {
  486. X        print;
  487. X        do print_prologue();
  488. X        last;
  489. X    }
  490. X    print;
  491. X}
  492. X
  493. Xwhile (<>) {
  494. X    #
  495. X    # to use slightly busted NeXT previewer
  496. X    #
  497. X    next if /^%%Pages:/;
  498. X    if (/^%%Page:/) {
  499. X        do enter_page();
  500. X        next;
  501. X    }
  502. X    if (/^%%Trailer/) {
  503. X        do print_trailer();
  504. X        next;
  505. X    }
  506. X    print;
  507. X}
  508. X# print actual page count.  This must be the last trailer comment
  509. X# printed.
  510. X#
  511. Xprint "%%Pages: $sheet\n";
  512. Xexit(0);
  513. X
  514. X# the prolog consists of simple command definitions you want to make
  515. X# available to the configuration routines.  None of them do anything
  516. X# complicated, but why make life more difficult for the user?
  517. X#
  518. Xsub print_prologue {
  519. X    print <<EOF;
  520. X%%BeginProcSet: up_prolog 1 $$
  521. X/UpDict$$ $plines 3 add dict def
  522. XUpDict$$ begin
  523. X$prolog
  524. X/UpShowpage {showpage} bind def
  525. X/UpState {} def
  526. Xend
  527. X/showpage {} def
  528. X%%EndProcSet: up_prolog 1 $$
  529. XEOF
  530. X}
  531. X
  532. X# basically, at the beginning of a page, pull the number from the page
  533. X# header, take it modulo $modulus, and print things based on that #
  534. X# number.  If it's 1, end the previous sheet (if there is one),
  535. X# increment the sheet number, and print a sheet header.     For all
  536. X# pages, print the appropriate page motion command.
  537. X#
  538. Xsub enter_page {
  539. X    $page++;
  540. X    ($foo,$bar,$oldpage) = split;
  541. X    die "Help! page number mismatch, stopped" if ($oldpage != $page);
  542. X    $temp = $page % $modulus;
  543. X    if ($temp == 1) {
  544. X        if ($sheet++) {
  545. X            print 
  546. X              "UpDict$$ begin UpState restore UpShowpage end\n";
  547. X        }
  548. X        print <<EOF;
  549. X%%Page: ? $sheet
  550. XUpDict$$ begin
  551. Xsave /UpState exch def
  552. XEOF
  553. X        print $sheet % 2 ? $var{'odd'} : $var{'even'},"\n";
  554. X        print $var{"scale"},"\n";
  555. X    }else{
  556. X        print "UpDict$$ begin\n";
  557. X    }
  558. X    $temp = $modulus unless $temp;
  559. X    print $var{$temp},"\n";
  560. X    print "end\n";
  561. X}
  562. X
  563. X# print the trailer, which for us consists of a showpage (inserted
  564. X# before the trailer comment, to make it part of the last page).
  565. X#
  566. Xsub print_trailer {
  567. X    print "UpDict$$ begin UpState restore UpShowpage end\n" if $page;
  568. X    print "%%Trailer\n";
  569. X}
  570. X
  571. X# read the prolog from the configuration file.    All lines up to the
  572. X# the first one starting with '.' will be placed in $prolog
  573. X#
  574. Xsub read_prolog {
  575. X    $prolog='';
  576. X    #plines=0;
  577. X    while (<config>) {
  578. X        last if /^\./;
  579. X        $prolog .= $_;
  580. X        $plines++;
  581. X    }
  582. X    chop($prolog);
  583. X    $plines+=3;
  584. X}
  585. END_OF_FILE
  586. if test 4810 -ne `wc -c <'up'`; then
  587.     echo shar: \"'up'\" unpacked with wrong size!
  588. fi
  589. chmod +x 'up'
  590. # end of 'up'
  591. fi
  592. if test -f 'makeup' -a "${1}" != "-c" ; then 
  593.   echo shar: Will not clobber existing file \"'makeup'\"
  594. else
  595. echo shar: Extracting \"'makeup'\" \(1092 characters\)
  596. sed "s/^X//" >'makeup' <<'END_OF_FILE'
  597. X#!/usr/bin/perl
  598. X# test page printing for up.  print arg pages, each with a box around
  599. X# the edges (.25 inches in), and the page number in large type.
  600. X#  This is useful for debugging page layouts, as well as just wasting
  601. X# paper.
  602. X#
  603. X# usage: makeup count
  604. X#
  605. X# jgreely@cis.ohio-state.edu, 89/10/23
  606. X#
  607. X$count = $ARGV[0];
  608. Xdie "usage: makeup count\n" unless $count > 0;
  609. X
  610. X$date = `date`;
  611. Xchop($date);
  612. X
  613. Xprint <<EOF;
  614. X%!PS-Adobe-1.0
  615. X%%Creator: makeup
  616. X%%Title: Page Layout Test
  617. X%%CreationDate: $date
  618. X%%Pages: (atend)
  619. X%%DocumentFonts: Times-Roman
  620. X%%BoundingBox: 0 0 612 792
  621. X%%EndComments
  622. X/inch {72 mul} def
  623. X/Nfont /Times-Roman findfont 5 inch scalefont def
  624. X/drawpage {
  625. X    2 setlinecap 3 setlinewidth 0 setgray
  626. X    Nfont setfont
  627. X    dup stringwidth
  628. X    11 inch exch sub 2 div
  629. X    exch 8.5 inch exch sub 2 div
  630. X    exch moveto show
  631. X    0.25 inch dup moveto
  632. X    8 inch 0 rlineto
  633. X    0 10.5 inch rlineto
  634. X    -8 inch 0 rlineto
  635. X    0 -10.5 inch rlineto
  636. X    closepath stroke
  637. X    showpage
  638. X} def
  639. X%%EndProlog
  640. XEOF
  641. X
  642. Xfor ($page=1;$page <= $count;$page++) {
  643. X    print "%%Page: ? $page\n($page) drawpage\n";
  644. X}
  645. X
  646. Xprint <<EOF;
  647. X%%Trailer
  648. X%%Pages: $count
  649. XEOF
  650. Xexit(0);
  651. END_OF_FILE
  652. if test 1092 -ne `wc -c <'makeup'`; then
  653.     echo shar: \"'makeup'\" unpacked with wrong size!
  654. fi
  655. chmod +x 'makeup'
  656. # end of 'makeup'
  657. fi
  658. if test -f 'parr' -a "${1}" != "-c" ; then 
  659.   echo shar: Will not clobber existing file \"'parr'\"
  660. else
  661. echo shar: Extracting \"'parr'\" \(2661 characters\)
  662. sed "s/^X//" >'parr' <<'END_OF_FILE'
  663. X#!/usr/bin/perl
  664. X#parr:
  665. X# rearrange conforming PS code to print the pages in an arbitrary
  666. X# order.  The -[sS] options (for signature order) assume two-up, left
  667. X# to right.  The -o option takes a list of ranges, like this:
  668. X#    1-5    1-10,11-20    11-,1-10
  669. X# usage: parr [-o list] [-s] [-S n] [file]
  670. X#
  671. X# jgreely@cis.ohio-state.edu, 89/10/23
  672. X
  673. X$order='';
  674. X$signFlag='';
  675. X$signCount=0;
  676. X$DEBUG=0;
  677. X$rangePrint=0;
  678. X$TMPDIR='/tmp';
  679. X
  680. Xwhile ($_ = $ARGV[0],/^-/) {
  681. X    shift;
  682. X    last if /^-\-$/;
  683. X    /^-o/ && ($order = shift,next);
  684. X    /^-S/ && ($signCount = shift,$signFlag++,next);
  685. X    /^-s/ && ($signFlag++,next);
  686. X    /^-d/ && ($DEBUG++,next);
  687. X    /^-r/ && ($rangePrint++,next);
  688. X    die "usage: parr [-d] [-r] [-o list] [-s] [-S n] [file]\n";
  689. X}
  690. Xif ($signFlag && $order) {
  691. X    die "parr: -s and -o cannot be used together\n";
  692. X}
  693. X
  694. X$file = "$TMPDIR/p$$.header";
  695. X@files = ($file);
  696. X$sheet=0;
  697. Xopen(file,">$file") ||
  698. X  die "$file: $!, stopped";
  699. Xwhile (<>) {
  700. X    #
  701. X    # hack to use NeXT Preview: strip old '%%Pages:' lines
  702. X    #
  703. X    next if /^%%Pages:/;
  704. X    if (/^%%Page:/) {
  705. X        close(file);
  706. X        $sheet++;
  707. X        $file = "$TMPDIR/p$$.$sheet";
  708. X        push(@files,$file);
  709. X        open(file,">$file") ||
  710. X          die "$file: $!, stopped";
  711. X    }
  712. X    if (/^%%Trailer/) {
  713. X        close(file);
  714. X        $file = "$TMPDIR/p$$.trailer";
  715. X        push(@files,$file);
  716. X        open(file,">$file") ||
  717. X          die "$file: $!, stopped";
  718. X    }
  719. X    print file $_;
  720. X}
  721. Xclose(file);
  722. X
  723. X@order = ();
  724. Xif ($order) {
  725. X    foreach $range (split(/,/,$order)) {
  726. X        ($start,$sep,$end) = split(/(-)/,$range);
  727. X        $start = 1 unless $start;
  728. X        $end = $sheet unless $end;
  729. X        if ($sep) {
  730. X            push(@order,$start..$end);
  731. X        }else{
  732. X            push(@order,$start);
  733. X        }
  734. X    }
  735. X}elsif ($signFlag) {
  736. X    if (! $signCount) {
  737. X        $signCount = $sheet;
  738. X        $signCount += (4 - $sheet % 4) if ($sheet % 4);
  739. X    }else{
  740. X        $signCount *=4;
  741. X    }
  742. X    for($base=0;$base<$sheet;$base+=$signCount) {
  743. X        @tmp = ($signCount/2+$base);
  744. X        push(@tmp,$tmp[0]+1,$tmp[0]+2,$tmp[0]-1);
  745. X        while ($tmp[3] > $base) {
  746. X            push(@order,@tmp);
  747. X            @tmp = ($tmp[0]-2,$tmp[1]+2,$tmp[2]+2,$tmp[3]-2);
  748. X        }
  749. X    }
  750. X}else{
  751. X    @order = (1..$sheet);
  752. X}
  753. X
  754. X@tmp=@order;
  755. X@order=();
  756. Xforeach $page (@tmp) {
  757. X    push(@order,$page > $sheet ? "B" : $page);
  758. X}
  759. X
  760. Xif ($rangePrint) {
  761. X    print join(',',@order),"\n";
  762. X    unlink @files unless $DEBUG;
  763. X    exit(0);
  764. X}
  765. X
  766. Xopen(file,"$TMPDIR/p$$.header");
  767. X$_ = <file>;
  768. Xprint $_,"%%Pages: (atend)\n";
  769. Xprint while <file>;
  770. Xclose(file);
  771. X
  772. Xforeach $page (@order) {
  773. X    $count++;
  774. X    print "%%Page: ? $count\n%%OldPage: $page\n";
  775. X    if ($page eq "B") {
  776. X        print "showpage\n";
  777. X    }else{
  778. X        open(file,"$TMPDIR/p$$.$page");
  779. X        while (<file>) {
  780. X            print unless /^%%Page:/;
  781. X        }
  782. X        close(file);
  783. X    }
  784. X}
  785. Xopen(file,"$TMPDIR/p$$.trailer");
  786. Xprint while <file>;
  787. Xclose(file);
  788. Xprint "%%Pages: $count\n";
  789. X
  790. Xunlink @files unless $DEBUG;
  791. Xexit(0);
  792. END_OF_FILE
  793. if test 2661 -ne `wc -c <'parr'`; then
  794.     echo shar: \"'parr'\" unpacked with wrong size!
  795. fi
  796. chmod +x 'parr'
  797. # end of 'parr'
  798. fi
  799. if test -f 'up.rc' -a "${1}" != "-c" ; then 
  800.   echo shar: Will not clobber existing file \"'up.rc'\"
  801. else
  802. echo shar: Extracting \"'up.rc'\" \(3086 characters\)
  803. sed "s/^X//" >'up.rc' <<'END_OF_FILE'
  804. X# jgreely@cis.ohio-state.edu, 89/10/23
  805. X#
  806. X
  807. X# this is the normal prolog, and defines everything used below
  808. X#
  809. Xprolog=
  810. X/inch {72 mul} def
  811. X/moveU {0 11 inch translate} def
  812. X/moveR {8.5 inch 0 translate} def
  813. X/moveD {0 -11 inch translate} def
  814. X/moveL {-8.5 inch 0 translate} def
  815. X/rotR {-90 rotate} def
  816. X/rotL {90 rotate} def
  817. X/doSpiral {moveU moveR rotR 0.67 dup scale} def
  818. X/moveHU { 0 5.5 inch translate} def
  819. X/doRevSpiral {moveHU rotL 0.67 dup scale} def
  820. X.
  821. X
  822. X# up is a synonym for twoup, since my code doesn't work correctly for
  823. X# the case n==1.  Until I robustify it, this will stay.
  824. X#
  825. Xname=up
  826. Xmodulus=2
  827. Xscale=7.75 inch 0 translate rotL 11 17 div dup scale
  828. X1=
  829. X2=moveR
  830. X.
  831. X
  832. Xname=2up
  833. Xmodulus=2
  834. Xscale=7.75 inch 0 translate rotL 11 17 div dup scale
  835. X1=
  836. X2=moveR
  837. X.
  838. X
  839. X# two-up with even pages rotated, for double-siding
  840. X#
  841. Xname=pup
  842. Xmodulus=2
  843. Xeven=moveU moveR rotR rotR
  844. Xodd=
  845. Xscale=7.75 inch 0 translate rotL 11 17 div dup scale
  846. X1=
  847. X2=moveR
  848. X.
  849. X
  850. X# note that 4up is scaled a bit smaller than you might think.  If I
  851. X# just scaled by .5, I'd lose my top and bottom edges (printer
  852. X# limitations)
  853. X#
  854. Xname=4up
  855. Xmodulus=4
  856. Xscale=0.2125 inch 0.275 inch translate 0.475 dup scale
  857. X1=moveU
  858. X2=moveR
  859. X3=moveL moveD
  860. X4=moveR
  861. X.
  862. X
  863. X# this does a greeting-card format, designed to be folded into
  864. X# fourths.  If you're not sure how it's supposed to look, run:
  865. X#    makeup 4 | up -n card | lpr
  866. X#
  867. Xname=card
  868. Xmodulus=4
  869. Xscale=0.2125 inch 0.275 inch translate 0.475 dup scale
  870. X1=moveU moveU moveR rotR rotR
  871. X2=moveU moveU moveR rotR rotR
  872. X3=moveR
  873. X4=moveU moveU moveR rotR rotR
  874. X.
  875. X
  876. X# this is about the limit for a 300 dpi device, unless it's reasonably
  877. X# new and you have good eyes.  I like it at 400 dpi.
  878. X#
  879. Xname=6up
  880. Xmodulus=6
  881. Xscale=0.25 inch 0.75 inch translate rotL 4 11 div dup scale
  882. X1=moveD
  883. X2=moveR
  884. X3=moveR
  885. X4=moveD moveL moveL
  886. X5=moveR
  887. X6=moveR
  888. X.
  889. X
  890. X# this is a bit too far for casual reading.  It's entering magnifying
  891. X# glass territory, which is bad, unless you need to carry lots of RFCs
  892. X# around.
  893. X#
  894. Xname=8up
  895. Xmodulus=8
  896. Xscale=0.7 inch 0 translate rotL 11 34 div dup scale
  897. X1=moveD
  898. X2=moveR
  899. X3=moveR
  900. X4=moveR
  901. X5=moveD moveL moveL moveL
  902. X6=moveR
  903. X7=moveR
  904. X8=moveR
  905. X.
  906. X
  907. X# Steve Romig's contribution to evil PostScript hacking.  To see what
  908. X# it does, run:
  909. X#    makeup 10 | up -n spiral | lpr
  910. X#
  911. Xname=spiral
  912. Xmodulus=10
  913. Xscale=7.75 inch 0 translate rotL 11 17 div dup scale
  914. X1=
  915. X2=doSpiral
  916. X3=doSpiral
  917. X4=doSpiral
  918. X5=doSpiral
  919. X6=doSpiral
  920. X7=doSpiral
  921. X8=doSpiral
  922. X9=doSpiral
  923. X10=doSpiral
  924. X.
  925. X
  926. X# More from Steve, this time in the other direction
  927. X#
  928. Xname=revspiral
  929. Xmodulus=10
  930. Xscale=7.75 inch 0 translate rotL 11 17 div dup scale
  931. X1=moveR
  932. X2=doRevSpiral
  933. X3=doRevSpiral
  934. X4=doRevSpiral
  935. X5=doRevSpiral
  936. X6=doRevSpiral
  937. X7=doRevSpiral
  938. X8=doRevSpiral
  939. X9=doRevSpiral
  940. X10=doRevSpiral
  941. X.
  942. X
  943. X# this is not legible on anything under 400 dpi, and even then you'll
  944. X# probably want a magnifying glass.  You *can* read it with the naked
  945. X# eye, but not for long.
  946. X#
  947. Xname=16up
  948. Xmodulus=16
  949. Xscale=0.25 0.25 scale
  950. X1=moveU moveU moveU
  951. X2=moveR
  952. X3=moveR
  953. X4=moveR
  954. X5=moveD moveL moveL moveL
  955. X6=moveR
  956. X7=moveR
  957. X8=moveR
  958. X9=moveD moveL moveL moveL
  959. X10=moveR
  960. X11=moveR
  961. X12=moveR
  962. X13=moveD moveL moveL moveL
  963. X14=moveR
  964. X15=moveR
  965. X16=moveR
  966. X.
  967. END_OF_FILE
  968. if test 3086 -ne `wc -c <'up.rc'`; then
  969.     echo shar: \"'up.rc'\" unpacked with wrong size!
  970. fi
  971. # end of 'up.rc'
  972. fi
  973. if test -f 'up.1' -a "${1}" != "-c" ; then 
  974.   echo shar: Will not clobber existing file \"'up.1'\"
  975. else
  976. echo shar: Extracting \"'up.1'\" \(2731 characters\)
  977. sed "s/^X//" >'up.1' <<'END_OF_FILE'
  978. X.TH UP 1 "23 October 1989"
  979. X.SH NAME
  980. Xup \- convert conforming PostScript files to print n-up
  981. X.br
  982. Xmakeup \- create numbered test pages for up
  983. X.SH SYNOPSIS
  984. X.B up
  985. X[
  986. X.B \-f
  987. Xconfig_file ] [
  988. X.B \-n
  989. Xname ] [ file ... ]
  990. X.PP
  991. X.B makeup
  992. Xcount
  993. X.SH DESCRIPTION
  994. X.I Up
  995. Xreads a conforming PostScript file, and performs translation,
  996. Xrotation, and scaling operations to print several pages on one sheet
  997. Xof paper.  It uses a human-readable configuration file to determine
  998. Xhow to arrange pages, and selects named layouts based on the name the
  999. Xprogram was called by (see also the
  1000. X.I \-f
  1001. Xoption).  The output is also conforming, which means that it can be
  1002. Xfed back through for further reduction.
  1003. X.PP
  1004. XThe configuration file is slightly magical, but easy to use for simple
  1005. Xlayouts.  Quite complicated effects are possible by embedding
  1006. Xarbitrary PostScript commands.  See
  1007. X.IR spiral ,
  1008. Xin the supplied configuration file.  The format is completely
  1009. Xdescribed in uprc(5).
  1010. X.PP
  1011. X.I Makeup
  1012. Xis a simple utility that generates
  1013. X.I count
  1014. Xpages of conforming PostScript to stdout, with each page containing a
  1015. X10.5x8 inch box, and a large page number.  Its main excuse for
  1016. Xexistence is debugging new layouts, although the enterprising could
  1017. Xset up calendar formats.
  1018. X.SH OPTIONS
  1019. X.TP
  1020. X.B \-f
  1021. X.I config_file
  1022. XUse an alternate configuration file.  Normally, it uses the last of
  1023. Xthe following that is found: /usr/local/lib/up.rc, ~/.uprc ./up.rc.
  1024. X.TP
  1025. X.B \-n
  1026. X.I name
  1027. XExplicitly specify what page layout to use, no matter what name the
  1028. Xprogram was called by.  This is handy for testing new layouts, and
  1029. Xconfigurations that you haven't created links for yet.
  1030. X.SH FILES
  1031. X.PD 0
  1032. X.TP 25
  1033. X.B /usr/local/lib/up.rc 
  1034. Xglobal configuration
  1035. X.TP
  1036. X.B ~/.uprc 
  1037. Xuser's personal configuration
  1038. X.TP
  1039. X.B ./up.rc
  1040. Xcurrent directory's configuration
  1041. X.br
  1042. X.ne 5
  1043. X.PD
  1044. X.SH "SEE ALSO"
  1045. XPostScript Language Reference Manual, perl(1), ptroff(1), enscript(1),
  1046. Xpsdvi(1), dvips(1), uprc(5)
  1047. X.SH AUTHOR
  1048. XJ Greely (jgreely@cis.ohio-state.edu), Ohio State University, Department
  1049. Xof Computer and Information Science, etc.  Laws warranted where voided
  1050. Xby Prohibition.
  1051. X.SH STATUS
  1052. XHighly experimental, and dangerous in the wrong hands.  Not to be used
  1053. Xwhile under the influence of whimsy.
  1054. X.SH BUGS
  1055. XDoesn't seem to work with psdvi output, although dvips (3.4) works.
  1056. X.PP
  1057. XThe configuration file parsing is less than robust.
  1058. X.PP
  1059. XSome would say that the use of
  1060. X.I Perl
  1061. Xis a bug.
  1062. X.PP
  1063. XThe way I test for conformance with Adobe's document structuring
  1064. Xconventions is iffy.  I don't apologize for it, but I don't like it,
  1065. Xeither.  Eventually, I'll break down and do proper checking, probably
  1066. Xwhen I convert it all to C.
  1067. X.PP
  1068. X.IR Makeup 's
  1069. Xpage numbering doesn't fit within the margins after page 999.  I have
  1070. Xno intention of fixing this.
  1071. END_OF_FILE
  1072. if test 2731 -ne `wc -c <'up.1'`; then
  1073.     echo shar: \"'up.1'\" unpacked with wrong size!
  1074. fi
  1075. # end of 'up.1'
  1076. fi
  1077. if test -f 'makeup.1' -a "${1}" != "-c" ; then 
  1078.   echo shar: Will not clobber existing file \"'makeup.1'\"
  1079. else
  1080. echo shar: Extracting \"'makeup.1'\" \(14 characters\)
  1081. sed "s/^X//" >'makeup.1' <<'END_OF_FILE'
  1082. X.so man1/up.1
  1083. END_OF_FILE
  1084. if test 14 -ne `wc -c <'makeup.1'`; then
  1085.     echo shar: \"'makeup.1'\" unpacked with wrong size!
  1086. fi
  1087. # end of 'makeup.1'
  1088. fi
  1089. if test -f 'parr.1' -a "${1}" != "-c" ; then 
  1090.   echo shar: Will not clobber existing file \"'parr.1'\"
  1091. else
  1092. echo shar: Extracting \"'parr.1'\" \(1245 characters\)
  1093. sed "s/^X//" >'parr.1' <<'END_OF_FILE'
  1094. X.TH PARR 1 "23 October 1989"
  1095. X.SH NAME
  1096. Xparr \- rearrange pages in a PostScript file, for signatures
  1097. X.SH SYNOPSIS
  1098. X.B parr
  1099. X[
  1100. X.B \-r
  1101. X] [
  1102. X.B \-s
  1103. X] [
  1104. X.B \-S
  1105. X.I sheets
  1106. X] [
  1107. X.B \-o
  1108. X.I pagelist
  1109. X] [file]
  1110. X.SH DESCRIPTION
  1111. X.I Parr
  1112. Xreads a conforming PostScript file, and rearranges the pages in
  1113. Xinteresting ways, of which the primary one is signature order (for
  1114. Xdouble-sided, two-up printing).  Pages can be printed more than once
  1115. Xor not at all, and blank pages may be inserted anywhere.
  1116. X.SH OPTIONS
  1117. X.TP
  1118. X.B \-r
  1119. XJust print the page order to stdout.
  1120. X.TP
  1121. X.B \-s
  1122. XPrint in signature order.  Default is to make one large signature,
  1123. Xunless the 
  1124. X.B \-S
  1125. Xoption is used.  The output is meant to be passed through "up -n pup".
  1126. X.TP
  1127. X.B \-S
  1128. X.I sheets
  1129. XImplies the
  1130. X.B \-s
  1131. Xflag.  Used to indicate how many sheets should be in each signature.
  1132. XNote that this is the number of
  1133. X.I double-sided
  1134. Xsheets.
  1135. X.TP
  1136. X.B \-o
  1137. X.I pagelist
  1138. XArbitrary order.  Pages are specified as a comma-separated list of
  1139. Xpage ranges, like this: 21-,11-19,20,-10.  A 'B' may be used to
  1140. Xindicate the printing of a blank page.
  1141. X.SH "SEE ALSO"
  1142. XPostScript Language Reference Manual, up(1)
  1143. X.SH AUTHOR
  1144. XJ Greely (jgreely@cis.ohio-state.edu), Ohio State University, Department
  1145. Xof Computer and Information Science, etc.
  1146. END_OF_FILE
  1147. if test 1245 -ne `wc -c <'parr.1'`; then
  1148.     echo shar: \"'parr.1'\" unpacked with wrong size!
  1149. fi
  1150. # end of 'parr.1'
  1151. fi
  1152. if test -f 'uprc.5' -a "${1}" != "-c" ; then 
  1153.   echo shar: Will not clobber existing file \"'uprc.5'\"
  1154. else
  1155. echo shar: Extracting \"'uprc.5'\" \(2484 characters\)
  1156. sed "s/^X//" >'uprc.5' <<'END_OF_FILE'
  1157. X.TH UPRC 5 "24 August 1989"
  1158. X.SH NAME
  1159. Xuprc \- layout configuration file for "up"
  1160. X.SH DESCRIPTION
  1161. XThe
  1162. X.I uprc
  1163. Xfile contains all of the information necessary to describe a page
  1164. Xlayout for the
  1165. X.I up
  1166. Xutility.  The format is simple, but capable of some impressively
  1167. Xtwisted output.  A sample configuration is given below, followed by a
  1168. Xcomplete explanation.  Records in a file begin with a line containing
  1169. Xeither "name=something" or "prolog=", and end with a line containing
  1170. Xjust a period.
  1171. X.IP
  1172. X prolog=
  1173. X /inch {72 mul} def
  1174. X /moveU {0 11 inch translate} def
  1175. X /moveR {8.5 inch 0 translate} def
  1176. X /moveD {0 -11 inch translate} def
  1177. X /moveL {-8.5 inch 0 translate} def
  1178. X /rotR {-90 rotate} def
  1179. X /rotL {90 rotate} def
  1180. X .
  1181. X
  1182. X name=4up
  1183. X modulus=4
  1184. X scale=0.2125 inch 0.275 inch translate 0.475 dup scale
  1185. X 1=moveU
  1186. X 2=moveR
  1187. X 3=moveL moveD
  1188. X 4=moveR
  1189. X .
  1190. X.PP
  1191. XThe
  1192. X.I prolog
  1193. Xrecord contains an arbitrary number of lines of PostScript code to be
  1194. Xplaced right before the "%%EndProlog" comment in the header.  These
  1195. Xcommands must not effect the graphics state, and should only be used
  1196. Xto define functions for use at page breaks.  The default header (shown
  1197. Xabove) defines functions to move the page origin (in terms of pages),
  1198. Xand rotate the co-ordinate space 90 degrees left and right.  More than
  1199. Xone header can be present in a file; the
  1200. X.I last
  1201. Xone found before the desired layout record will be used.
  1202. X.PP
  1203. XLayout records contain five types of fields.
  1204. X.IR name ,
  1205. X.IR modulus ,
  1206. X.IR even/odd ,
  1207. X.IR <number> ,
  1208. Xand
  1209. X.IR scale .
  1210. XThe 
  1211. X.I name
  1212. Xfield may contain any number of alphanumeric characters, and
  1213. Xis what determines the logical record name.  The
  1214. X.I modulus
  1215. Xfield must contain a decimal number indicating the number of pages to
  1216. Xbe placed on a sheet.  There should be fields numbered from 1 through
  1217. X.IR modulus ,
  1218. Xcontaining the PostScript commands to move the origin to the correct
  1219. Xplace for that page (relative to the location of the previously
  1220. Xprinted page).  The
  1221. X.I scale
  1222. Xfield contains PostScript commands that set up the scaling at the
  1223. Xbeginning of each sheet.  Despite the name, rotations and translations
  1224. Xalso belong here.  The
  1225. X.I even/odd
  1226. Xfields are used to make even and odd sheets print differently.
  1227. XThey're not often useful, but they're handy for preparing double-sided
  1228. Xoutput.
  1229. X.PP
  1230. XBlank lines and lines beginning with a "#" character are ignored.
  1231. X.SH FILES
  1232. X/usr/local/lib/up.rc, ~/.uprc, ./up.rc
  1233. X.SH "SEE ALSO"
  1234. Xup(1), PostScript Language Reference Manual
  1235. X.SH AUTHOR
  1236. XJ Greely (jgreely@cis.ohio-state.edu)
  1237. END_OF_FILE
  1238. if test 2484 -ne `wc -c <'uprc.5'`; then
  1239.     echo shar: \"'uprc.5'\" unpacked with wrong size!
  1240. fi
  1241. # end of 'uprc.5'
  1242. fi
  1243. echo shar: End of shell archive.
  1244. exit 0
  1245.  
  1246.